package com.google.code.whitetask;

public class ActionPhrase {
  Flow parentFlow;
  Result result;

  public ActionPhrase(Flow flow, Result result) {
    this.parentFlow = flow;
    this.result = result;
  }

  public Clause retryUntil(int count) {
    Clause resultClause = new Clause(new RetryTask(result, count));
    parentFlow.clauses.add(resultClause);
    return resultClause;
  }
  
  public Clause execute(Task task) {
    Clause resultClause =  new Clause(new ConditionalTask(result, task));
    parentFlow.clauses.add(resultClause);
    return resultClause;
  }
}
